package Practice16;

import java.io.FileNotFoundException;
import java.io.IOException;

public class ThrowsDemo {
    public static void main(String[] args) throws IOException {
        read("b.txt");
    }

    public static void read(String str) throws FileNotFoundException, IOException {
        if (!str.equals("a.txt")) {
//            System.out.println("文件存在");
            throw new FileNotFoundException("文件不存在");
        }
        if (!str.equals("b.txt")) {
            throw new IOException("也不存在");
        }
    }
}
